package sample;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ezinzng on 11/7/2016.
 */
public class DataHelper {

    public enum CoalType {
        PINGYI("平一"), PINGER("平二"), PINGSAN("平三"), PINGHUN("平混"), PINGWU("平五"), PINGLIU("平六"), PINGQI("平七"), PINGBA("平八"), PINGJIU("平九"), PINGSHI("平十"), ZHIDA("直达");

        private String name;

        CoalType(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }

    public enum SamplingType {
        AUTO("机采"), MANUAL("人工");

        private String name;

        SamplingType(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }

    public enum Port {
        QIN("秦港"), JINGTANG("京唐港"), CAOFEIDIAN("曹妃甸");

        private String name;

        Port(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }

    public enum TestOrg {
        SHIJIAN("市检"), SHANGJIAN("商检"), QINHUA("秦华煤检"), HUAXIA("华夏力宏");

        private String name;

        TestOrg(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }
    public static Map<Port, TestOrg> portCheckerMapping;

    public DataHelper() {
        init();
    }

    public static String[] toArray(Class<? extends Enum<?>> e) {
        return Arrays.stream(e.getEnumConstants()).map(Enum::toString).toArray(String[]::new);
    }

    private void init() {
        portCheckerMapping = new HashMap<>();
        portCheckerMapping.put(Port.QIN, TestOrg.SHIJIAN);
        portCheckerMapping.put(Port.QIN, TestOrg.SHANGJIAN);
        portCheckerMapping.put(Port.JINGTANG, TestOrg.SHIJIAN);
        portCheckerMapping.put(Port.JINGTANG, TestOrg.SHANGJIAN);
        portCheckerMapping.put(Port.CAOFEIDIAN, TestOrg.SHANGJIAN);
        portCheckerMapping.put(Port.CAOFEIDIAN, TestOrg.HUAXIA);
        portCheckerMapping.put(Port.CAOFEIDIAN, TestOrg.QINHUA);
    }
}
